{"ast":null,"code":"import _defineProperty from \"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/defineProperty.js\";\nimport _slicedToArray from \"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/slicedToArray.js\";\nimport EnterOutlined from \"@ant-design/icons/es/icons/EnterOutlined\";\nimport classNames from 'classnames';\nimport KeyCode from \"rc-util/es/KeyCode\";\nimport * as React from 'react';\nimport TextArea from '../input/TextArea';\nimport { cloneElement } from '../_util/reactNode';\nimport useStyle from './style';\nvar Editable = function Editable(_ref) {\n  var prefixCls = _ref.prefixCls,\n    ariaLabel = _ref['aria-label'],\n    className = _ref.className,\n    style = _ref.style,\n    direction = _ref.direction,\n    maxLength = _ref.maxLength,\n    _ref$autoSize = _ref.autoSize,\n    autoSize = _ref$autoSize === void 0 ? true : _ref$autoSize,\n    value = _ref.value,\n    onSave = _ref.onSave,\n    onCancel = _ref.onCancel,\n    onEnd = _ref.onEnd,\n    component = _ref.component,\n    _ref$enterIcon = _ref.enterIcon,\n    enterIcon = _ref$enterIcon === void 0 ? /*#__PURE__*/React.createElement(EnterOutlined, null) : _ref$enterIcon;\n  var ref = React.useRef(null);\n  var inComposition = React.useRef(false);\n  var lastKeyCode = React.useRef();\n  var _React$useState = React.useState(value),\n    _React$useState2 = _slicedToArray(_React$useState, 2),\n    current = _React$useState2[0],\n    setCurrent = _React$useState2[1];\n  React.useEffect(function () {\n    setCurrent(value);\n  }, [value]);\n  React.useEffect(function () {\n    if (ref.current && ref.current.resizableTextArea) {\n      var textArea = ref.current.resizableTextArea.textArea;\n      textArea.focus();\n      var length = textArea.value.length;\n      textArea.setSelectionRange(length, length);\n    }\n  }, []);\n  var onChange = function onChange(_ref2) {\n    var target = _ref2.target;\n    setCurrent(target.value.replace(/[\\n\\r]/g, ''));\n  };\n  var onCompositionStart = function onCompositionStart() {\n    inComposition.current = true;\n  };\n  var onCompositionEnd = function onCompositionEnd() {\n    inComposition.current = false;\n  };\n  var onKeyDown = function onKeyDown(_ref3) {\n    var keyCode = _ref3.keyCode;\n    // We don't record keyCode when IME is using\n    if (inComposition.current) return;\n    lastKeyCode.current = keyCode;\n  };\n  var confirmChange = function confirmChange() {\n    onSave(current.trim());\n  };\n  var onKeyUp = function onKeyUp(_ref4) {\n    var keyCode = _ref4.keyCode,\n      ctrlKey = _ref4.ctrlKey,\n      altKey = _ref4.altKey,\n      metaKey = _ref4.metaKey,\n      shiftKey = _ref4.shiftKey;\n    // Check if it's a real key\n    if (lastKeyCode.current === keyCode && !inComposition.current && !ctrlKey && !altKey && !metaKey && !shiftKey) {\n      if (keyCode === KeyCode.ENTER) {\n        confirmChange();\n        onEnd === null || onEnd === void 0 ? void 0 : onEnd();\n      } else if (keyCode === KeyCode.ESC) {\n        onCancel();\n      }\n    }\n  };\n  var onBlur = function onBlur() {\n    confirmChange();\n  };\n  var textClassName = component ? \"\".concat(prefixCls, \"-\").concat(component) : '';\n  var _useStyle = useStyle(prefixCls),\n    _useStyle2 = _slicedToArray(_useStyle, 2),\n    wrapSSR = _useStyle2[0],\n    hashId = _useStyle2[1];\n  var textAreaClassName = classNames(prefixCls, \"\".concat(prefixCls, \"-edit-content\"), _defineProperty({}, \"\".concat(prefixCls, \"-rtl\"), direction === 'rtl'), className, textClassName, hashId);\n  return wrapSSR( /*#__PURE__*/React.createElement(\"div\", {\n    className: textAreaClassName,\n    style: style\n  }, /*#__PURE__*/React.createElement(TextArea, {\n    ref: ref,\n    maxLength: maxLength,\n    value: current,\n    onChange: onChange,\n    onKeyDown: onKeyDown,\n    onKeyUp: onKeyUp,\n    onCompositionStart: onCompositionStart,\n    onCompositionEnd: onCompositionEnd,\n    onBlur: onBlur,\n    \"aria-label\": ariaLabel,\n    rows: 1,\n    autoSize: autoSize\n  }), enterIcon !== null ? cloneElement(enterIcon, {\n    className: \"\".concat(prefixCls, \"-edit-content-confirm\")\n  }) : null));\n};\nexport default Editable;","map":{"version":3,"names":["EnterOutlined","classNames","KeyCode","React","TextArea","cloneElement","useStyle","Editable","_ref","prefixCls","ariaLabel","className","style","direction","maxLength","autoSize","value","onSave","onCancel","onEnd","component","enterIcon","createElement","ref","useRef","inComposition","lastKeyCode","useState","current","setCurrent","useEffect","resizableTextArea","textArea","focus","length","setSelectionRange","onChange","_ref2","target","replace","onCompositionStart","onCompositionEnd","onKeyDown","_ref3","keyCode","confirmChange","trim","onKeyUp","_ref4","ctrlKey","altKey","metaKey","shiftKey","ENTER","ESC","onBlur","textClassName","wrapSSR","hashId","textAreaClassName","rows"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/antd/es/typography/Editable.js"],"sourcesContent":["import EnterOutlined from \"@ant-design/icons/es/icons/EnterOutlined\";\nimport classNames from 'classnames';\nimport KeyCode from \"rc-util/es/KeyCode\";\nimport * as React from 'react';\nimport TextArea from '../input/TextArea';\nimport { cloneElement } from '../_util/reactNode';\nimport useStyle from './style';\nconst Editable = _ref => {\n  let {\n    prefixCls,\n    'aria-label': ariaLabel,\n    className,\n    style,\n    direction,\n    maxLength,\n    autoSize = true,\n    value,\n    onSave,\n    onCancel,\n    onEnd,\n    component,\n    enterIcon = /*#__PURE__*/React.createElement(EnterOutlined, null)\n  } = _ref;\n  const ref = React.useRef(null);\n  const inComposition = React.useRef(false);\n  const lastKeyCode = React.useRef();\n  const [current, setCurrent] = React.useState(value);\n  React.useEffect(() => {\n    setCurrent(value);\n  }, [value]);\n  React.useEffect(() => {\n    if (ref.current && ref.current.resizableTextArea) {\n      const {\n        textArea\n      } = ref.current.resizableTextArea;\n      textArea.focus();\n      const {\n        length\n      } = textArea.value;\n      textArea.setSelectionRange(length, length);\n    }\n  }, []);\n  const onChange = _ref2 => {\n    let {\n      target\n    } = _ref2;\n    setCurrent(target.value.replace(/[\\n\\r]/g, ''));\n  };\n  const onCompositionStart = () => {\n    inComposition.current = true;\n  };\n  const onCompositionEnd = () => {\n    inComposition.current = false;\n  };\n  const onKeyDown = _ref3 => {\n    let {\n      keyCode\n    } = _ref3;\n    // We don't record keyCode when IME is using\n    if (inComposition.current) return;\n    lastKeyCode.current = keyCode;\n  };\n  const confirmChange = () => {\n    onSave(current.trim());\n  };\n  const onKeyUp = _ref4 => {\n    let {\n      keyCode,\n      ctrlKey,\n      altKey,\n      metaKey,\n      shiftKey\n    } = _ref4;\n    // Check if it's a real key\n    if (lastKeyCode.current === keyCode && !inComposition.current && !ctrlKey && !altKey && !metaKey && !shiftKey) {\n      if (keyCode === KeyCode.ENTER) {\n        confirmChange();\n        onEnd === null || onEnd === void 0 ? void 0 : onEnd();\n      } else if (keyCode === KeyCode.ESC) {\n        onCancel();\n      }\n    }\n  };\n  const onBlur = () => {\n    confirmChange();\n  };\n  const textClassName = component ? `${prefixCls}-${component}` : '';\n  const [wrapSSR, hashId] = useStyle(prefixCls);\n  const textAreaClassName = classNames(prefixCls, `${prefixCls}-edit-content`, {\n    [`${prefixCls}-rtl`]: direction === 'rtl'\n  }, className, textClassName, hashId);\n  return wrapSSR( /*#__PURE__*/React.createElement(\"div\", {\n    className: textAreaClassName,\n    style: style\n  }, /*#__PURE__*/React.createElement(TextArea, {\n    ref: ref,\n    maxLength: maxLength,\n    value: current,\n    onChange: onChange,\n    onKeyDown: onKeyDown,\n    onKeyUp: onKeyUp,\n    onCompositionStart: onCompositionStart,\n    onCompositionEnd: onCompositionEnd,\n    onBlur: onBlur,\n    \"aria-label\": ariaLabel,\n    rows: 1,\n    autoSize: autoSize\n  }), enterIcon !== null ? cloneElement(enterIcon, {\n    className: `${prefixCls}-edit-content-confirm`\n  }) : null));\n};\nexport default Editable;"],"mappings":";;AAAA,OAAOA,aAAa,MAAM,0CAA0C;AACpE,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,OAAO,MAAM,oBAAoB;AACxC,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,OAAOC,QAAQ,MAAM,mBAAmB;AACxC,SAASC,YAAY,QAAQ,oBAAoB;AACjD,OAAOC,QAAQ,MAAM,SAA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